package com.atguigu.ssyx.acl.controller;


import com.atguigu.ssyx.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@Controller
@ResponseBody
@RequestMapping("/admin/acl/index")
@Api(tags = "登录接口")
public class IndexController {

    @PostMapping("login")
    @ApiOperation("用户登录")
    public Result login() {
        Map<String, Object> map = new HashMap<>();
//        data里面是对象类型,使用hashmap.如果有数组使用集合.
        map.put("token", "admin-token");
        return Result.ok(map);
    }

    /**
     * 2 获取用户信息
     */
    @GetMapping("info")
    @ApiOperation("用户信息获取")
    public Result info() {
        Map<String, Object> map = new HashMap<>();
        map.put("name", "atguigu");
        map.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }

    /**
     * 3 退出
     */
    @PostMapping("logout")
    @ApiOperation("用户退出")
    public Result logout() {
        return Result.ok(null);
    }
}
